const express = require('express')
const router = express.Router()
const { reg_addArticles } = require('../schema/article')
const handlerFn = require('./handler/article')
const expressJoi = require('@escook/express-joi')
const multer = require('multer')
const path = require('path')

// 创建文件上传的处理器
const upload = multer({
  dest: path.join(__dirname, '../public/upload/article')
})

router.post('/add/article', upload.single('cover_img'),expressJoi(reg_addArticles), handlerFn.handlerAddArticle)


module.exports = router
